<%@ page contentType="text/html;charset=UTF-8" %>
<%@include file="../../common/sessionValidate.jsp" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html lang="UTF-8">
<head>
    <title>物业费打印</title>
    <%@ include file="../../common/meta.jsp" %>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <link rel="stylesheet" href="<%=basePath%>css/my-bootstrap.css" media="screen" id="tuserskin">
    <link rel="stylesheet" href="<%=basePath%>js/toastr/toastr.css">
    <link rel="stylesheet" href="<%=basePath%>css/bootstrapValidator.min.css">
    <link rel="stylesheet" href="<%=basePath%>css/font-awesome.min.css">
    <script type="text/javascript" src="<%= basePath %>js/jquery.cookie.js"></script>
    <script language=javascript>
        function printpreview() {
            // 打印页面预览
            wb.execwb(7, 1);
        }

        function printit() {
            wb.ExecWB(6, 1);
            //if (confirm('确定打印吗？')){
            //    wb.ExecWB(6,1);
            //}
        }

    </script>
</head>
<style>
    hr {
        margin-top: 1px;
        border-bottom: 1px solid #1BBC9B;
    }
</style>
<style media="print">.noprint {
    DISPLAY: none
}</style>
<body>
<div class="noprint" style="width:1000px;margin:50px auto;font-size:14px;text-align:right;">
    <OBJECT id="wb" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" name="wb"></OBJECT>
    <input value="IE打印" type="button" onclick="javascript:printit();"/>
    <!--<input type=button name=button_setup value="打印页面设置" onclick="javascript:printsetup();"> -->
    <input type=button name=button_show value="打印预览" onclick="javascript:printpreview();">
    <input type=button name=button_fh value="关闭" onclick="javascript:window.close();">
    <input type=button name=button_fh value="普通打印" onclick="javascript:window.print();">
</div>

<div style="width: 1000px;margin: 40px auto;font-size: 18px;font-weight: bold;text-align: center;">电费付款通知单</div>
<div style="width: 1000px;margin: 10px auto;font-size: 16px;overflow:hidden;">
    <p style="margin-top: 5px;">
        <span id="buildname"></span><span id="housename"></span>（<span id="compnayname"></span>）
    </p>
    <p style="margin-top: 5px;">
        结算周期: <span id="billstartdate"></span>日-<span id="billenddate"></span>日
    </p>
</div>
<table border="1" cellpadding="0" cellspacing="0" class="table table-bordered" style="width: 1000px;margin: 10px auto;font-size: 14px;">
    <tr border="1">
        <th>上期抄表读数</th>
        <th>本期抄表读数</th>
        <th>倍率</th>
        <th>本期用电量</th>
        <th>单价（元）</th>
        <th>金额（元）</th>
        <th>备注</th>
    </tr>
    <tr>
        <td id="yuemo"></td>
        <td id="yuechu"></td>
        <td >1</td>
        <td id="num"></td>
        <td id="minprice"></td>
        <td id="totalprice"></td>
        <td ></td>
    </tr>
</table>
<div style="width: 1000px;margin: 10px auto;font-size: 16px;overflow:hidden;">
    <p style="margin-top: 20px;">收款单位：<span id="accountname"></span></p>
    <p>开 户 行：<span id="bank"></span></p>
    <p>收款账号：<span id="accountno"></span></p>
    <p style="margin-top: 20px;">物业联系电话：021-63866786</p>
    <p>注：此账号为唯一收款账号，物业不会私自用个人或者其他账号收款，请勿将钱款转入其他账号或者私人账号。</p>
    <div style="width: 400px;float:right;margin-top: 50px;line-height: 36px;">
        <p>上海天安金谷科技园企业发展有限公司</p>
        <p>日期：<span id="payday"></span></p>
    </div>
</div>
<div style="width: 1000px;margin: 20px auto;font-size: 18px;font-weight: bold;text-align: center;overflow:hidden;">
    <hr>
    <p style="margin-top: 40px;">电费付款通知单（回执）</p>
</div>
<div style="width: 1000px;margin: 20px auto;font-size: 16px;overflow:hidden;">
    <p>本人已收到上述付款通知单，并知晓通知内容。</p>
    <p>缴纳周期：<span id="billstartdate2"></span>日-<span id="billenddate2"></span>日</p>
    <p>应缴金额：<span id="totalprice2"></span>元</p>
    <div style="width: 400px;float:right;margin-top: 50px;line-height: 36px;">
        <p>签收单位：<span id="companyname2"></span></p>
        <p>签章：</p>
        <p>签收日期：</p>
    </div>
</div>
</body>
</html>


<script src="<%=basePath%>js/bootstrap.min.js"></script>
<!--<script src="<%=basePath%>js/jquery-1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrapValidator.js"></script>-->
<script src="<%=basePath%>js/bootstrap-paginator.min.js"></script>
<script src="<%=basePath%>/js/respond.js"></script>
<script src="<%=basePath%>/js/html5.js"></script>
<script src="<%=basePath%>js/toastr/toastr.js"></script>
<script src="<%=basePath%>js/bootbox.js"></script>
<script src="<%=basePath%>js/jquery.validate.js"></script>
<!-- <script src="<%=basePath%>js/additional-methods.min.js"></script> -->
<script src="<%=basePath%>js/my-jquery-curd.js"></script>
<script src="<%= basePath %>js/tableSortTool.js"></script>
<script src="<%= basePath %>js/calendar.js"></script>
<script type="text/javascript">
    //初始化页面及校验
    $().ready(function () {
        //设置不打印页眉页脚； 只需要在打印单据的电脑上浏览器  打印设置中去掉页眉页脚即可；
        //pagesetup_null();

        //1、初始化数据显示
        var name = "电费账单打印";
        var optype = '<%=request.getParameter("oplx")%>';
        var id = '<%=request.getParameter("id")%>';
        //alert("optype="+optype+";id="+id);
        if (optype == 'dianfei') {
            //var basePath = "<i class='icon-eye-open'></i>&nbsp;";//设置addHeaderDiv标题文字及按钮
            //setHeader2("打印" + name, basePath);
            //setButtonDivView2();//设置adddiv的 操作按钮
            var url = "<%=basePath%>t_contract_bill/getT_contract_bill?id=" + id + "&time=" + Math.random();
            $.getJSON(url, function (data) {//获取数据，并且自动填充form，自动代码待修改； @todo;
                //alert(data.billid);
                $("#compnayname").html(data.ext1);
                $("#buildname").html(data.ext2);
                $("#housename").html(data.ext3);

                $("#yuechu").html(data.ext6);
                $("#yuemo").html(data.ext5);

                $("#num").html((data.ext6 - data.ext5));
                $("#totalprice").html(data.totalprice);
                $("#minprice").html(data.minprice);
                $("#payday").html(data.payday);
                $("#billstartdate").html(data.billstartdate);
                $("#billenddate").html(data.billenddate);
                $("#billstartdate2").html(data.billstartdate);
                $("#billenddate2").html(data.billenddate);
                $("#totalprice2").html(data.totalprice);
                $("#companyname").html(data.ext1);
                $("#companyname2").html(data.ext1);

                //获取账号信息
                var urlbank = "<%=basePath%>t_data_dic/getAllT_data_dic?startIndex=0&pageSize=100&data_group=wuyeaccount&data_type_name=物业收款信息&time=" + Math.random();
                //alert(urlbank);
                $.getJSON(urlbank, function (data) {
                    $.each(data.items, function (i, item) {
                        if (item.data_no == "accountname") {
                            //alert(item.data_no);
                            $("#accountname").html(item.data_name);
                        } else if (item.data_no == "accountno") {
                            $("#accountno").html(item.data_name);
                        } else if (item.data_no == "bank") {
                            $("#bank").html(item.data_name);
                        }
                    });//end each data;
                });
            });
        }
    }) //end funciton read;

</script>

